package daa.levelup.UnitFactory;

import daa.levelup.Forge.IForge;
import daa.levelup.Forge.MakeWeapon;
import daa.levelup.Forge.Weapons;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;


public class MainFactory {

    public static void main(String[] args) {

        Unit warrior = UnitFactory.createUnit(UnitType.WARRIOR);
        System.out.println(warrior.getName() + " created");
        Unit wizard = UnitFactory.createUnit(UnitType.WIZARD);
        System.out.println(wizard.getName() + " created");
        Unit archer = UnitFactory.createUnit(UnitType.ARCHER);
        System.out.println(archer.getName() + " created");
        Unit[] units =
                {

                        warrior, wizard, archer

                };

        for (int i = 0; i < units.length; i++)
            units[i].getAttackCount();
        System.out.println(Arrays.toString(units));
        IForge sword = MakeWeapon.createWeapon(Weapons.BOW);
        IForge staff = MakeWeapon.createWeapon(Weapons.STAFF);
        IForge bow = MakeWeapon.createWeapon(Weapons.SWORD);

        List<IForge> all = new ArrayList<IForge>();
        all.add(bow);
        all.add(staff);
        all.add(sword);

        Iterator<IForge> iterforge = all.iterator();
        IForge tmpForge;
        while(iterforge.hasNext()){
            tmpForge = iterforge.next();
            System.out.println(tmpForge.getName() + ". attck " + tmpForge.attack() +". weight "+ tmpForge.weight());
        }



    }

}



